﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Infrastructure.WpfClient.Views.Master;
using Microsoft.Practices.Unity;
using System.ComponentModel;
using System.Windows.Data;
using Skynet.BusinessEntities;
using System.Windows.Documents;
using System.Windows.Markup;

namespace Skynet.C2SModule.Presenters
{
    public class BookWritterPresenter : MasterPresenter<Views.BookWritter.IBookWritterView>
    {
        public BookWritterPresenter(IUnityContainer container) : base( container)
        {
        }

       // [Dependency]
      //  public BusinessLogic.BusinessComponents.IBCBooks BCBooks { get; set; }        
        public ICollectionView Books { get; set; }

        public override void OnViewReady()
        {
            //Books = CollectionViewSource.GetDefaultView(BCBooks.GetAll().ToList());                        
            //foreach (var item in Books)
            //{
            //    (item as INotifyPropertyChanged).PropertyChanged += new PropertyChangedEventHandler(BookWritterPresenter_PropertyChanged);                    
            //}
            //this.InvokePropertyChanged("Books");            
        }        

        void BookWritterPresenter_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            //var item = sender as Book;
            //item.MarkAsModified();            
            //this.BCBooks.Update(item);
        }
    }
}
